﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Clipper.Model.DetectionModel
{
    public class Cup
    {

        public enum CupHoleStatusEnum
        {
            //设置杯子孔位的状态设置  HOLEEMPTY  HOLEFULL  HOLEEND
            EMPTY = 0,

            FULL = 1,

            END = 2,

            SAMPLE = 3,

            REAGENT1 = 4,

            REAGENT2 = 5,

            SAMPLEStart = 6,

        }

        private ReaderWriterLockSlim rwlLock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);

        private CupHoleStatusEnum status = CupHoleStatusEnum.EMPTY;

        //public CupHoleStatusEnum Status
        //{
        //    get
        //    {
        //        return status;
        //    }

        //    set
        //    {
        //        status = value;
        //    }
        //}

        public void setStatus(CupHoleStatusEnum state)
        {
            rwlLock.EnterWriteLock();
            try
            {
                this.status = state;
            }
            finally
            {
                rwlLock.ExitWriteLock();
            }
        }

        public CupHoleStatusEnum getStatus()
        {
            rwlLock.EnterReadLock();
            try
            {
                return this.status;
            }
            finally
            {
                rwlLock.ExitReadLock();
            }
        }

        /// <summary>
        /// 杯子的孔位     
        /// </summary>
        private int holeSeat;
        public int HoleSeat
        {
            get
            {
                return holeSeat;
            }

            set
            {
                holeSeat = value;
            }
        }
        /// <summary>
        /// 杯子的孔位     
        /// </summary>
        private int _inStripSeat;
        public int inStripSeat
        {
            get
            {
                return _inStripSeat;
            }

            set
            {
                _inStripSeat = value;
            }
        }

    }
}
